﻿#region System Namespace
using System;
using System.Linq;
#endregion System Namespace

#region Foreign Namespace
#endregion Foreign Namespace

#region Styx Namespace
using Styx.Plugins;
using Styx.WoWInternals.WoWObjects;
using Styx.WoWInternals;
#endregion Styx Namespace

namespace Auction
{
    public partial class Auction : HBPlugin
    {
        public void InteractWithMail()
        {
            try
            {
                var mailboxes = ObjectManager.GetObjectsOfType<WoWGameObject>(false, false).Where(o => o != null && o.Entry == MIRsettings.Instance.MailboxID).ToList();
                foreach (WoWGameObject obj in mailboxes.Where(obj => obj != null).Where(obj => obj.WithinInteractRange))
                {
                    obj.Interact();
                    Log("Interacting with Mailbox...");
                }
            }
            catch (Exception e)
            {
                Log("Error: " + e.Message);
            }
        }
    }
}